]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
overview: Handle unredirection in OverviewShown state machine
authorrobert.mader@collabora.com <robert.mader@collabora.com>
Tue, 26 Sep 2023 23:10:45 +0000 (01:10 +0200)
committerrobert.mader@collabora.com <robert.mader@collabora.com>
Wed, 27 Sep 2023 09:38:16 +0000 (11:38 +0200)
Under certain unknown circumstances currently not every
`disable_unredirect_for_display()` gets matched with an
`enable_unredirect_for_display()` when closing the overview.

As we only want to not disable unredirection when hidden and we nowadays
have a state machine that ensures we transition to and from one state to
another only once, handle unredirection en-/disablement as part of the
state transition.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2970>

js/ui/overview.js

index 66a83cf9d74f7d938f97c4d9a862a280f711b310..2b173a5e10a57d9948864ed957c1d73e6e8162dd 100644 (file)
@@ -305,6 +305,11 @@ export class Overview extends Signals.EventEmitter {
                 `${this._shownState} to ${state}`);
         }
 
+        if (this._shownState === OverviewShownState.HIDDEN)
+            Meta.disable_unredirect_for_display(global.display);
+        else if (state === OverviewShownState.HIDDEN)
+            Meta.enable_unredirect_for_display(global.display);
+
         this._shownState = state;
         this.emit(OVERVIEW_SHOWN_TRANSITIONS[state].signal);
     }
@@ -411,8 +416,6 @@ export class Overview extends Signals.EventEmitter {
 
     _gestureUpdate(tracker, progress) {
         if (!this._shown) {
-            Meta.disable_unredirect_for_display(global.display);
-
             this._shown = true;
             this._visible = true;
             this._visibleTarget = true;
@@ -567,8 +570,6 @@ export class Overview extends Signals.EventEmitter {
         this._visibleTarget = true;
         this._activationTime = GLib.get_monotonic_time() / GLib.USEC_PER_SEC;
 
-        Meta.disable_unredirect_for_display(global.display);
-
         Main.layoutManager.overviewGroup.set_child_above_sibling(
             this._coverPane, null);
         this._coverPane.show();
@@ -636,9 +637,6 @@ export class Overview extends Signals.EventEmitter {
     }
 
     _hideDone() {
-        // Re-enable unredirection
-        Meta.enable_unredirect_for_display(global.display);
-
         this._coverPane.hide();
 
         this._visible = false;
@@ -688,8 +686,6 @@ export class Overview extends Signals.EventEmitter {
         // the animation because of a race in the xserver where the grab
         // fails when requested very early during startup.
 
-        Meta.disable_unredirect_for_display(global.display);
-
         this._changeShownState(OverviewShownState.SHOWING);
 
         this._overview.runStartupAnimation(() => {